home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / kernel / sys / sysSubr.s.old < prev    next >
Encoding:
Text File  |  1992-12-19  |  2.6 KB  |  109 lines

  1. |* sunSubr.s --
  2. |*
  3. |*     Contains misc. assembler routines for the SUN.
  4. |*
  5. |* Copyright (C) 1985 Regents of the University of California
  6. |* All rights reserved.
  7. |*
  8. |* rcs = $Header: /cdrom/src/kernel/Cvsroot/kernel/sys/sysSubr.s.old,v 9.0 89/09/12 15:20:22 douglis Stable $ SPRITE (Berkeley)
  9. |*
  10.  
  11. #include "machConst.h"
  12. #include "asmDefs.h"
  13.  
  14. |*---------------------------------------------------------------------
  15. |*
  16. |* Sys_SetIntrLevel  --
  17. |*     
  18. |*    Enables interrupts of a certain level and above.
  19. |*    Input is a mask which specifies the interrupt level.
  20. |*
  21. |* Results:
  22. |*    The mask of the interrupt level
  23. |*
  24. |* Side effects:
  25. |*    Interrupts may be enabled or disabled.
  26. |*    Trace bit is always set to 0.
  27. |*
  28. |*---------------------------------------------------------------------
  29.  
  30.     .text
  31.     .globl    _Sys_SetIntrLevel
  32. _Sys_SetIntrLevel:
  33.     link    a6,#0
  34.     movl    a6@(8),d1        | copy argument to d1
  35.  
  36.                         | input error check:
  37.     andw    #MACH_SR_INTMASK,d1    | make sure the arg. has just
  38.                     | the interrupt bits set.
  39.  
  40.     orw    #MACH_SR_SUPSTATE,d1    | set the supervisor state bit
  41.  
  42.     clrl    d0
  43.     movw    sr,d0            | save status register in d0
  44.     andw    #MACH_SR_INTMASK,d0    | return previous interrupt level mask
  45.  
  46.     movw    d1,sr            | put new value in status register
  47.     unlk    a6
  48.     rts
  49.  
  50. #define    SAVED_REGS     0xFCFC
  51.  
  52. |*
  53. |* ----------------------------------------------------------------------
  54. |*
  55. |* SysSetJump --
  56. |*
  57. |*    Prepare for a non-local goto (i.e. Sys_LongJump).  This saves the
  58. |*    program counter and all local registers in the given Sys_SetJumpState
  59. |*    struct.
  60. |*    
  61. |*    SysSetJump(setJumpStatePtr)
  62. |*        Sys_SetJumpState    *setJumpStatePtr;
  63. |*
  64. |* Results:
  65. |*    None.
  66. |*
  67. |* Side effects:
  68. |*    None.
  69. |*
  70. |* ----------------------------------------------------------------------
  71. |*
  72.  
  73.     .globl    _SysSetJump
  74. _SysSetJump:
  75.     movl    sp@(4),a0        | Get the address of where to store the 
  76.                     |     registers in a register.
  77.     moveml    #SAVED_REGS,a0@(4)    | Save registers.
  78.     movl    sp@,a0@            | Save program counter of caller.
  79.     clrl    d0            | Return zero
  80.     rts
  81.  
  82. |*
  83. |* ----------------------------------------------------------------------
  84. |*
  85. |* Sys_LongJump --
  86. |*
  87. |*    Prepare for a non-local goto (i.e. Sys_LongJump).  This saves the
  88. |*    program counter and all local registers in the given Sys_SetJumpState
  89. |*    struct.
  90. |*    
  91. |* Results:
  92. |*    None.
  93. |*
  94. |* Side effects:
  95. |*    None.
  96. |*
  97. |* ----------------------------------------------------------------------
  98. |*
  99.  
  100.     .globl    _Sys_LongJump
  101. _Sys_LongJump:
  102.     movl    sp@(4),a0        | Get address of saved state.
  103.     moveml    a0@(4),#SAVED_REGS    | Restore registers (this causes the 
  104.                     |     stack to be changed).
  105.     movl    a0@,sp@            | Push the program counter onto the 
  106.                     |     stack.
  107.     movl    #1,d0            | Return FAILURE.
  108.     rts    
  109.